package cn.jcby.app.lebu.dao;

import cn.jcby.app.lebu.controller.req.db.UserNearByDbReq;
import cn.jcby.app.lebu.controller.res.UserNearByRes;
import cn.jcby.app.lebu.entity.UserEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;
import java.util.List;

/**
 * 个人信息表
 * 
 * @author lht
 * @email 
 * @date 2023-12-07 15:13:35
 */
@Mapper
public interface UserDao extends BaseMapper<UserEntity> {
    void updateLastPoint(UserEntity userEntity) ;

    void updateMileage(UserEntity userEntity) ;

    String queryPointStr(@Param("userId")String userId) ;

    List<UserNearByRes> queryNearUserList(UserNearByDbReq dbReq);

    Integer queryNearByCount(UserNearByDbReq dbReq) ;

    void lockEnergy(@Param("userId")String userId, @Param("emerge") BigDecimal emerge);

    void unlockEnergy(@Param("userId")String userId, @Param("emerge")BigDecimal emerge);

    void completeAndUnlockEnergy(@Param("userId") String userId, @Param("emerge") BigDecimal emerge,@Param("mileage") BigDecimal mileage);

    void gainRevenue(@Param("userId")String userId, @Param("emerge")BigDecimal emerge);


    Double selectDistance(@Param("participantUserId") String participantUserId, @Param("point")String point);

    @Update("update lb_user set open_id = #{openId} where id = #{userId}")
    void bindOpenId(@Param("userId") String userId, @Param("openId") String openId);
}
